/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import DAO.DAO_ServiceOffered;
import Entity.ServiceOffered;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author THANHDAT
 */
@ManagedBean
@RequestScoped
public class ServiceOfferedBean {

    List<ServiceOffered> lstOffred = new ArrayList<ServiceOffered>();
    ServiceOffered serviceOffer = new ServiceOffered();
    int id;
    String name;

    /** Creates a new instance of ServiceOfferedBean */
    public ServiceOfferedBean() {
    }

    public ServiceOffered getServiceOffer() {
        return serviceOffer;
    }

    public void setServiceOffer(ServiceOffered serviceOffer) {
        this.serviceOffer = serviceOffer;        
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
        DAO_ServiceOffered service = new DAO_ServiceOffered();
        serviceOffer = service.getServiceOfferedById(id);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<ServiceOffered> getLstOffred() {
        return lstOffred;
    }

    public void setLstOffred(List<ServiceOffered> lstOffred) {
        this.lstOffred = lstOffred;
    }

    public List<ServiceOffered> showOffered() {
        DAO_ServiceOffered offered = new DAO_ServiceOffered();
        lstOffred = offered.showServiceOffered();
        return lstOffred;
    }

    public List<ServiceOffered> showOfferedById() {
        DAO_ServiceOffered offered = new DAO_ServiceOffered();
        lstOffred = offered.getOfferedByDomainId(id);
        return lstOffred;
    }
}
